package xc.com.media.feign;

import feign.Headers;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;
import xc.com.media.config.FeignConfig;

import java.util.Map;

@FeignClient(value = "xc-oss",url = "localhost:8003",configuration = FeignConfig.class)
public interface OssFegin {
    /**
     * 上传图片
     * @param file
     * @return
     */
    @RequestLine(value = "POST file/upload")
    @Headers({"Content-Type: multipart/form-data"})
    String upload(MultipartFile file);

    /**
     *
     * @param file
     * @return
     */
    @RequestLine(value = "POST file/uploadMedia")
    @Headers({"Content-Type: multipart/form-data"})
    Map<String, Object> uploadMedia(MultipartFile file);

    /**
     *
     * @param fileName
     * @return
     */
    @RequestLine(value = "DELETE file/delete")
    boolean delete(@RequestBody String fileName);
}
